import java.util.LinkedList;
import java.util.Queue;

/**
 * @ClassName:
 * @author:
 * @Description:
 * @Date
 **/
//不用多余队列实现
public class MyStack2 {
    private Queue<Integer> queue;

    public MyStack2() {
        //初始化一个队列
        queue = new LinkedList<>();
    }

    //判断队列是否为空
    public boolean empty() {
        return queue.isEmpty();
    }

    //入栈
    public void push(int e) {
        queue.add(e);
        for (int i = 1; i < queue.size(); i++) {
            //执行n-1次出队再入队
            queue.add(queue.remove());
        }
    }

    public int pop() {
        return queue.remove();
    }

    public int top() {
        return queue.peek();
    }

}
